package org.xiji.Decorator;

/**
 * 装饰者模式测试类
 */
public class DecoratorMain
{
    public static void main(String[] args) {
        Component dog = new Dog();

        dog.introduce();

        //dog ==> blueClothes ==> Sunglasses
        System.out.println("=======================");
        System.out.println("给狗穿一件蓝色的衣服");
        dog = new BlueClothes(dog);
        dog.introduce();
        System.out.println("=======================");

        //把狗的衣服换下
        dog = new Dog();

        System.out.println("=======================");
        System.out.println("给狗穿上红色衣服");
        dog = new RedClothes(dog);


        System.out.println("给狗带上墨镜");
        dog = new Sunglasses(dog);
        dog.introduce();
        System.out.println("=======================");

        //创建一只宠物猫
        Component cat = new Cat();
        cat.introduce();
        System.out.println("=======================");
        System.out.println("给猫穿一件红色的衣服");
        cat = new RedClothes(cat);
        System.out.println("给猫带上墨镜");
        cat =new Sunglasses(cat);
        cat.introduce();
        System.out.println("=======================");








    }
}
